﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:localCalendar="clr-namespace:SLControlLibrary.Resources.Controls.Calendar.ExtendedCalendar"
    xmlns:localButtons="clr-namespace:SLControlLibrary.Resources.Controls.Calendar.Buttons">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/SLControlLibrary;component/Resources.Styles/ButtonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Calendar Extended -->
    <Style TargetType="localCalendar:ucCalendar">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="localCalendar:ucCalendar">
                    <Grid
                        x:Name="_GrdRoot"
                        Width="Auto"
                        HorizontalAlignment="Right">
                        <Grid.Resources>
                            <Storyboard x:Name="mvStkpLeft">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="spCollection" Storyboard.TargetProperty="(Canvas.Left)">
                                    <SplineDoubleKeyFrame x:Name="spldkf_left" KeyTime="00:00:00.4000000" Value="-640">
                                        <SplineDoubleKeyFrame.KeySpline>
                                            <KeySpline ControlPoint1="0,0.6" ControlPoint2="1,1"/>
                                        </SplineDoubleKeyFrame.KeySpline>
                                    </SplineDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Name="mvStkpRight">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="spCollection" Storyboard.TargetProperty="(Canvas.Left)">
                                    <SplineDoubleKeyFrame x:Name="spldkf_right" KeyTime="00:00:00.4000000" Value="0">
                                        <SplineDoubleKeyFrame.KeySpline>
                                            <KeySpline ControlPoint1="0,0.6" ControlPoint2="1,1"/>
                                        </SplineDoubleKeyFrame.KeySpline>
                                    </SplineDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Grid.Resources>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Grid
                            x:Name="Grid2"
                            Width="680"
                            Grid.ColumnSpan="3"
                            Grid.Row="0"                            
                            HorizontalAlignment="Center"
                            Background="Gray">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="15" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="15" />
                            </Grid.ColumnDefinitions>

                            <localButtons:ucCalendarButton 
                                x:Name="btnLeftYear"
                                Width="15" 
                                Height="15"
                                Grid.Column="0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                ButtonType="Left"
                                Background="{TemplateBinding Background}"
                                Style="{StaticResource CalendarButtonStyle}"/>

                            <TextBlock
                                x:Name="txtDesc"
                                Grid.Column="1"
                                VerticalAlignment="Top"
                                HorizontalAlignment="Center"
                                FontSize="18"
                                Margin="10,0,10,0"
                                Text="{TemplateBinding Desc}" />

                            <localButtons:ucCalendarButton 
                                x:Name="btnRightYear"
                                Width="15" 
                                Height="15"
                                Grid.Column="2"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Center"
                                ButtonType="Right"
                                Background="{TemplateBinding Background}"
                                Style="{StaticResource CalendarButtonStyle}"/>
                        </Grid>

                        <localButtons:ucCalendarButton 
                            x:Name="btnLeftMonth"
                            Width="15" 
                            Height="15"
                            Grid.Column="0"
                            Grid.Row="1"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center"
                            ButtonType="Left"
                            Background="{TemplateBinding Background}"
                            Style="{StaticResource CalendarButtonStyle}"/>

                        <Border
                            x:Name="_BrdRoot"
                            Width="650"
                            Grid.Row="1"
                            Grid.Column="1"
                            Height="{TemplateBinding MonthHeight}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}">
                            <Canvas
                                x:Name="cnvContainer"
                                Clip="M0.5,0.5 L650,0.5 L650,232.5 L0.5,232.5 z">
                                <StackPanel
                                    x:Name="spCollection"
                                    Height="Auto"
                                    Width="Auto"
                                    Orientation="Horizontal"
                                    HorizontalAlignment="Stretch"/>
                            </Canvas>
                        </Border>

                        <localButtons:ucCalendarButton 
                            x:Name="btnRightMonth"
                            Width="15" 
                            Height="15"
                            Grid.Column="2"
                            Grid.Row="1"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Center"
                            ButtonType="Right"
                            Background="{TemplateBinding Background}"
                            Style="{StaticResource CalendarButtonStyle}"/>

                        <StackPanel
                            x:Name="spLegend"
                            Height="Auto"
                            Width="Auto"
                            Grid.Row="2"
                            Grid.Column="0"
                            Grid.ColumnSpan="3"
                            VerticalAlignment="Bottom"
                            Orientation="Horizontal"
                            HorizontalAlignment="Right"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
